package com.neuedu.ylbx.controller;

import com.neuedu.ylbx.dto.PatientDto;
import com.neuedu.ylbx.service.DiseaseInfoService;
import com.neuedu.ylbx.service.DiseasediagnosisService;
import com.neuedu.ylbx.service.PatientsService;
import com.neuedu.ylbx.utils.ResultVo;
import com.neuedu.ylbx.vo.PatientsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/hospital")
@CrossOrigin
@Api(tags = "疾病诊断管理")
public class DiseasediagnosisController {
    @Autowired
    private DiseasediagnosisService  diseasediagnosisService;

    @Autowired
    private DiseaseInfoService diseaseInfoService;

    @ApiOperation("获取疾病列表")
    @GetMapping("/diseases")
    public ResultVo getDiseasePage ()  throws Exception{
        return diseasediagnosisService.getDiseasePage();
    }

    @ApiOperation("获取疾病列表")
    @PostMapping("/diagnoses/admission")
    public ResultVo addAdmissionDia(PatientDto patientDto)throws Exception{
        return diseasediagnosisService.addAdmissionDia(patientDto);
    }

    @ApiOperation("添加主要诊断")
    @PostMapping("/diagnoses/main")
    public ResultVo addMainDiagnoses(PatientDto patientDto)throws Exception{
        return diseasediagnosisService.addMainDiagnoses(patientDto);
    }

    @ApiOperation("添加其他诊断")
    @PostMapping("/diagnoses/other")
    public ResultVo addOtherDiagnoses(PatientDto patientDto)throws Exception{
        return diseasediagnosisService.addOtherDiagnoses(patientDto);
    }

    @ApiOperation("获取疾病列表")
    @GetMapping("/diagnoses/patient/{patientId}")
    public ResultVo<List<PatientsVo>> getDiagnosesPage ()  throws Exception{
        return diseasediagnosisService.getDiagnosesPage();
    }
}
